<template>
    <HeaderCom />
    <Menu :model="items">
        <template v-slot:item="{ item, props }">
            <router-link v-if="item.route" :to="item.route" custom v-slot="{ href, navigate }">
                <a :href="href" v-bind="props.action" @click="navigate">
                    <span :class="item.icon"></span>
                    <span class="ml-2">{{ item.label }}</span>
                </a>
            </router-link>
            <a v-else :href="item.url" :target="item.target" v-bind="props.action">
                <span :class="item.icon"></span>
                <span class="ml-2">{{ item.label }}</span>
            </a>
        </template>
    </Menu>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import Menu from 'primevue/menu';
import { useRouter } from 'vue-router';
import HeaderCom from "../components/HeaderCom.vue"

const router = useRouter();

const items = ref([
    {
        label: 'Router Link',
        icon: 'pi pi-palette',
        command: () => {
            router.push('/');
        }
    },
    {
        label: 'Programmatic',
        icon: 'pi pi-link',
        command: () => {
            router.push('/FenLei');
        }
    },
    {
        label: 'External',
        icon: 'pi pi-home',
        command: () => {
            router.push('/FenLei');
        }
    }
]);

</script>